//
//  ScoreView.swift
//  SWIFTLEARN
//
//  Created by Qivay on 2017/9/6.
//  Copyright © 2017年 linch. All rights reserved.
//

import UIKit

enum ScoreType {
    case commen
    case best
}
//protocol ScoreViewProtacol {
//    func changeScore(value s:Int)
//}
class ScoreView: UIView  /*,ScoreViewProtacol */{

    var label:UILabel!
    let defaultFrame = CGRect(x: 0, y: 0, width: 100, height: 30)
    var stype:String!
    var score:Int = 0{
        didSet{
            label.text = "\(stype!):\(score)"
        }
    }
    init(type:ScoreType)
    {
        label = UILabel(frame:defaultFrame)
        label.textAlignment = .center
        
        super.init(frame:defaultFrame)
        
        self.stype = (type == .commen ? "分数":"最高分")
        
        backgroundColor = UIColor.orange
        label.font = UIFont(name:"微软雅黑", size:16)
        label.textColor = UIColor.white
        self.addSubview(label)
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
//    func changeScore(value s: Int) {
//        score = s 
//    }

}
